#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n,m;
	while(scanf("%d %d",&n,&m)!=EOF)
	{
		char mp[n+1][m+1];
		int line[n][30]={0};
		int row[m][30]={0};
		for(int i = 0;i<n;i++)
		{
			for(int j = 0;j<m;j++)
			{
				cin>>mp[i][j];
				line[i][mp[i][j]-'a']++;
				row[j][mp[i][j]-'a']++;
			}
		}
		for(int i = 0;i<n;i++)
		{
			for(int j = 0;j<m;j++)
			{
				if(line[i][mp[i][j]-'a']==1&&row[j][mp[i][j]-'a']==1) cout<<mp[i][j];
			}
		}
		cout<<endl;
	}
}
